const child_process = require('child_process');

for (let i = 0; i < 3; i++) {
    var workProcess = child_process.spawn('node', ['index.js', i])
    workProcess.stdout.on('data', (data) => {
        console.log('data：' + data);

    })
    workProcess.stderr.on('data', (data) => {
        console.log('err：' + data);

    })
    workProcess.on('exit', (code) => {
        console.log('子进程已退出，状态码：', code);

    })
}

